from multi_robomaster import multi_robot

import time

import web
# from demo.tello_python.tello_manager import Tello
from demo.tello_python.tello import Tello

urls = (
    '/web_tello/left', 'left',
    '/web_tello/right', 'right',
    '/doAction', 'doAction',
    '/doCommand', 'doCommand'
)
app = web.application(urls, globals())

multi_drones = multi_robot.MultiDrone()
multi_drones.number_id_by_sn([0, '0TQZJ2TCNT0QLV'], [1, '0TQZJ2QCNT0N91'])
robot_group_all = multi_drones.build_group([0, 1])


#删除添加指定成员
# append(self, robots_id_list)
# remove(self, robots_id_list)
# robot_group_all.remove([1, 2])

def left():
    print(1)
    # 组内所有机器人前进1米，程序阻塞至所有机器人动作完成
    robot_group_all.chassis.move(0, 0, 0.1, 2, 180).wait_for_completed()

    # 组内所有机器人云台向向左旋转90度，程序阻塞至所有机器人动作完成
    robot_group_all.gimbal.move(0, 90).wait_for_completed()


if __name__ == '__main__':
    app.run()